package com.example.chapter3_1.service.impl;

import com.example.chapter3_1.entity.User;
import com.example.chapter3_1.mapper.LoginMapper;
import com.example.chapter3_1.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl implements LoginService {
    
    @Autowired
    private LoginMapper loginMapper;
    
    @Override
    public boolean login(String name, String password) {
        try {
            User user = loginMapper.findByNameAndPassword(name, password);
            return user != null;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }
} 